<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <link rel="shortcut icon" href="../../static/imgs/favicon.ico">
    <meta charset="utf-8">
    <title>简单百搭的找回密码页面3_dowebok</title>
    <link rel="stylesheet" href="../../static/css/login/style.css">
    <script src="../../static/js/jquery.1.10.1.min.js"></script>
    <script src="../../static/js/jquery.cookie.js"></script>
</head>
<body>
<div id="main">
    <form class="form">
        {{ csrf_input }}
        <div class="form-head">
            <h2>找回密码</h2>
        </div>
        <div class="form-body">
            <p class="err-msg" hidden>两次密码不一致，请重新输入</p>
            <div class="ui-input">
                <input type="password" class="new_password" placeholder="新密码">
            </div>
            <div class="ui-input">
                <input type="password" class="new_password2" placeholder="确认新密码">
            </div>
            <button class="ui-button ui-button--primary" id="step3">确定</button>
        </div>
        <script>
            $(function () {
                // 下一步
                $("#step3").click(function () {
                    event.preventDefault();
                    params = {
                        "new_password": $(".new_password").val(), // 新密码
                        "new_password2": $(".new_password2").val(), // 再次输入新密码
                        "csrfmiddlewaretoken": $("*[name='csrfmiddlewaretoken']").val(),
                    };
                    $.ajax({
                        url: "/forgetthird/",
                        type: "post",
                        data: JSON.stringify(params),
                        headers: {
                            'X-CSRFToken': $.cookie('csrftoken')
                        },
                        async: false,
                        contentType: "application/json",
                        success: function (resp) {
                            if (resp.errno == "0") {
                                alert("修改成功");
                                location.href = "/login/"
                            } else {
                                $(".err-msg").show()
                            }
                        },
                    });
                })

            })
        </script>
    </form>
</div>

<script src="../../static/js/script.js"></script>
</body>
</html>